package com.internetCafes.spms.web.customer.common.cont;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class CommonConst {

    /**
     * 管理层标记
     */
    public enum FlagEnum {
        NOT(0, "否"),
        IS(1, "是"),
        ;
        /**
         * 值
         */
        private Integer id;

        /**
         * 类型
         */
        private String flag;

        FlagEnum(Integer id, String flag) {
            this.id = id;
            this.flag = flag;
        }

        public Integer getId() {
            return id;
        }

        public String getFlag() {
            return flag;
        }

        public static List<Integer> getFlagList() {
            return Arrays.stream(values()).map(FlagEnum::getId).collect(Collectors.toList());
        }

        public static String getFlagById(Integer id) {
            for (FlagEnum flagEnum: values()) {
                if (flagEnum.getId().equals(id)) {
                    return flagEnum.getFlag();
                }
            }
            return "";
        }
    }
}
